﻿using System;
using System.Collections.Generic;
using BIS.Portal.Core.Base;
using BIS.Portal.Core.Global;

namespace BIS.Portal.Modules.CMS
{
    public partial class CmsAdvanceSearchControl_Settings : ControlSettingBase
    {
        #region Load data settings
         public bool HienThiAnh
        {
            get
            {
                return base.GetControlSetting<bool>(ModuleSettingNames.CmsAdvanceSearch.ddlAnhMinhHoa, PortalContext.LanguageAlias);
            }
        }

        public bool HienThiLinkXemCT
        {
            get
            {
                return base.GetControlSetting<bool>(ModuleSettingNames.CmsAdvanceSearch.ddlLinkCT, PortalContext.LanguageAlias);
            }
        }

        public bool HienThiMoTa
        {
            get
            {
                return base.GetControlSetting<bool>(ModuleSettingNames.CmsAdvanceSearch.ddlMoTa, PortalContext.LanguageAlias);
            }
        }

        public string SoLuongTin
        {
            get
            {
                return base.GetControlSetting<string>(ModuleSettingNames.CmsAdvanceSearch.txtSLTin, PortalContext.LanguageAlias);
            }
        }
        #endregion
       

        protected void Page_Load(object sender, EventArgs e)
        {
            this.loaddata();
        }

        private void loaddata()
        {
            this.txtSLTin.Text = this.SoLuongTin;
            this.ddlAnhMinhHoa.SelectedIndex = this.HienThiAnh ? 0 : 1;
            this.ddlMoTa.SelectedIndex = this.HienThiAnh ? 0 : 1;
            this.ddlLinkCT.SelectedIndex = this.HienThiLinkXemCT ? 0 : 1;
        }

        public override void SaveSettings(Dictionary<string, string> settings)
        {
            base.SetControlSettingForAllLanguages(this.txtSLTin.ID, "txtSLTin", settings);
            base.SetControlSettingForAllLanguages(this.ddlAnhMinhHoa.ID, "ddlAnhMinhHoa", settings);
            base.SetControlSettingForAllLanguages(this.ddlMoTa.ID, "ddlMoTa", settings);
            base.SetControlSettingForAllLanguages(this.ddlLinkCT.ID, "ddlLinkCT", settings);
        }

    }
}